package object3.package1;

public class Triangle extends Shape{
    private int bottom; //底边
    private int high;   //高

    public Triangle() {
        super();
    }

    public Triangle(int bottom, int high) {
        this.bottom = bottom;
        this.high = high;
        calcArea();
    }

    public void setBottom(int bottom) {
        this.bottom = bottom;
    }

    public void setHigh(int high) {
        this.high = high;
    }

    @Override
    public void draw() {
        System.out.println("▲");
    }

    @Override
    public void calcArea() {
        area = bottom * high / 2.0;
    }

    @Override
    public String toString() {
        return "Triangle{" +
                "bottom=" + bottom +
                ", high=" + high +
                ", area=" + area +
                '}';
    }
}
